package com.ms.exception;

import org.springframework.validation.MapBindingResult;

/**
 * User: gmc
 * Date: 14/03/13
 */
public class DpwcSpringValidationException extends DpwcValidationException {

    MapBindingResult springValidationErrors;
    boolean isJsr303 = false;
    private String mainMessage;

    public DpwcSpringValidationException(MapBindingResult springValidationErrors, boolean jsr303) {
        this.springValidationErrors = springValidationErrors;
        isJsr303 = jsr303;
    }

    public DpwcSpringValidationException(String message, Object... parameters) {
        super(message, parameters);
    }

    public DpwcSpringValidationException(String message) {
        super(message);
    }

    public DpwcSpringValidationException(String message, Throwable cause) {
        super(message, cause);
    }

    public boolean isSpringValidation() {
        return springValidationErrors != null;
    }

    public MapBindingResult getSpringValidationErrors() {
        return springValidationErrors;
    }

    public boolean isJsr303() {
        return isJsr303;
    }

    public void setMainMessage(String mainMessage) {
        this.mainMessage = mainMessage;
    }

    public String getMainMessage() {
        return mainMessage;
    }

}
